<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

</body>
<script type="text/javascript">
function getBall(x,y,n){
	//6<x  x<20
	if (x<6||x>20||y<1||y>16||n<1) {
		return false;
	}else{
		var redBall=[],blueBall=[];
		while(redBall.length<x){
			//random 取值范围0~1
			var ran=Math.floor(Math.random()*33);
			if (redBall.indexOf(ran)==-1) {
				redBall.push(ran);
			}
		}
		while(blueBall.length<x){
			//random 取值范围0~1
			var ran=Math.floor(Math.random()*16);
			if (redBall.indexOf(ran)==-1) {
				redBall.push(ran);
			}
		}
		for (var i = 0; i < n; i++) {
			if (n%5==0) {
				console.log(redBall.sort(function(a,b){
					return a-b
				}),blueBall.sort(function(a,b){
					return a-b;
				}));
			}
		}
	}
}
getBall(8,3,9);




</script>
</html>